package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernatePersistantIntegerIdVO;

/**
 * RegionRoute entity. @author MyEclipse Persistence Tools <b><i>powered by
 * Belev</i></b>
 */
@Entity
@Table(name = "regions_routes")
@GeneratorKey(tableName = "regions_routes")
public class RegionRouteVO extends HibernatePersistantIntegerIdVO {

	private static final long serialVersionUID = 4588518440827091324L;

	@Column(name = "description")
	private String description;

	@Column(name = "region", nullable = false)
	private boolean isRegion;

	@Column(name = "name", nullable = false)
	private String name;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "region_id")
	private RegionRouteVO region;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "region")
	private List<RegionRouteVO> routes;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "structure_id", nullable = false)
	private StructureVO structure;

	/** default constructor */
	public RegionRouteVO() {
		this.routes = new ArrayList<RegionRouteVO>();
	}

	/** @return the description */
	public String getDescription() {
		return this.description;
	}

	/** @return the name */
	public String getName() {
		return this.name;
	}

	/** @return the region */
	public RegionRouteVO getRegion() {
		return this.region;
	}

	/** @return the routes */
	public List<RegionRouteVO> getRoutes() {
		return this.routes;
	}

	/** @return the structure */
	public StructureVO getStructure() {
		return this.structure;
	}

	/** @return the isRegion */
	public boolean isRegion() {
		return this.isRegion;
	}

	/** @param description */
	public void setDescription(String description) {
		this.description = description;
	}

	/** @param name */
	public void setName(String name) {
		this.name = name;
	}

	/** @param isRegion */
	public void setRegion(boolean isRegion) {
		this.isRegion = isRegion;
	}

	/** @param region */
	public void setRegion(RegionRouteVO region) {
		this.region = region;
	}

	/** @param routes */
	public void setRoutes(List<RegionRouteVO> routes) {
		this.routes = routes;
	}

	/** @param structure */
	public void setStructure(StructureVO structure) {
		this.structure = structure;
	}
}